<?php
/*
 * 城市检测
 * @author      Mark
 * @datetime    13-1-10 上午9:05
 */

include '../../../common.inc.php';
include 'fun.php';
$mysqli = new mysqli('localhost', 'root', '', 'test_data');

$sql = "select distinct chengshi from koubei_myisam2 where areaid ='0' limit 100";
$result = $mysqli->query($sql);
$res = $result->fetch_all(MYSQLI_ASSOC);
if (!$res) exit('No More Results');
$sqle = '';
foreach ($res as $key => $value) {
	$areaid = area2areaid($value['chengshi']);
	if (!$areaid) {
		$areaid = '99999';
	}
	$sqle .= "update koubei_myisam2 set areaid ='{$areaid}' WHERE chengshi='{$value['chengshi']}';<br/>";
}
echo $sqle;exit();

$mysqli->query($sql);


echo '<pre style="font-size:100px;">';
echo $res['chengshi'];
echo '</pre>';
echo '<meta http-equiv="refresh" content="0; url='.$_SERVER['PHP_SELF'].'" />';
?>